<?php
session_start();
if (!isset($_SESSION['alogin']))
{
	echo "<br><h2>You are not Logged On Please Login to Access this Page</h2>";
	echo "<a href=index.php><h3 align=center>Click Here for Login</h3></a>";
	exit();
}
?>
<link href="../quiz.css" rel="stylesheet" type="text/css">
<?php
require("../database.php");

include("header.php");


//echo "<br><h2><div  class=head1>Add Test</div></h2>";
if($_POST[submit]=='Save' || strlen($_POST['subid'])>0 )
{
extract($_POST);
//comments 1
//added newly to check test exists or not
$rs=mysql_query("select * from mst_test where test_name='$testname'");
if (mysql_num_rows($rs)>0)
{
	echo "<br><br><br><div class=head1>Test is Already Exists</div>";
	exit;
}
// end of comments 1
mysql_query("insert into mst_test(sub_id,test_name,total_que) values ('$subid','$testname','$totque')",$cn) or die(mysql_error());
echo "<h2><p align=center>Test <b>\"$testname\"</b> Added Successfully.</p></h2>";
echo "</br></br></br><center><h3><a href='questionadd.php'>To add Questions click here</a></h3></center>";

unset($_POST);
}
?>
